<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加-</title>
<link rel="stylesheet" type="text/css" href="css/css.css" />
<!-- 自动补全样式 -->
<link rel="stylesheet" type="text/css" href="css/jquery.autocomplete.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<!-- 自动补全js -->
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
<!-- 日历插件js -->
<script type="text/javascript" src="js/calendar/WdatePicker.js"></script>
<style>
	td{border:0px}
	.bor {
    border: 0px solid #ccc;
}
	.btext2 .text2{
	font-size: 16px;
	min-width:292px;
	}
</style>
</head>
<body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="img/coin02.png" /><span><a href="main.do">首页</a>&nbsp;-&nbsp;
				<a href="getBusinessList.do">商机管理</a>&nbsp;-</span>&nbsp;商机详情
			</div>
		</div>
		<div class="page ">
			<!-- 上传广告页面样式 -->
			<div class="banneradd bor">
				<form action="getBusinessList.do" method="post" id="businessForm">
				<div class="baTopNo">
					<span>商机信息</span>
					<hr/>
				</div>
				<div class="baBody" >
					<table >	
						<tr class="bbD"  >
							<td class="td">机构名称：</td>
							<td ><input type="text" class="input3" id="orgName" onblur="orgNameTest()" readonly="readonly" value="${business.org.name }"/>	
								 <input type="hidden" name="oid" id="oid" value="${business.org.id }"/>
							</td>
							<td><span id="tip1"></span> </td>
							<td><input type="hidden" name="id" id="id" value="${business.id }" /></td>					
						</tr>
						<tr class="bbD" >
							<td class="td">联系人：</td><td><input type="text" readonly="readonly" value="${business.org.contact.name }" readonly="readonly" class="input3" id="cname"/></td>
						</tr>
						<tr class="bbD">
							<td class="td">手机号码：</td><td><input type="text" readonly="readonly" value="${business.org.contact.phone }" readonly="readonly" class="input3" id="cphone" /></td>
						</tr>
						<tr class="bbD">
							<td class="td">经办人：</td><td><input class="input3" readonly="readonly" value="${business.org.contact.ename }" readonly="readonly" type="text" id="ename"/></td>
						</tr>
						<tr class="bbD">
							<td class="td">年费: </td>
							<td><input class="input3" type="text" id="annualfee" readonly="readonly" value="${business.annualfee }" name="annualfee" onblur="annualfeeTest()"/></td>
							<td><span id="tip2"></span> </td>
						</tr>
						<tr class="bbD">
							<td class="td">电子资源经费: </td>
							<td><input class="input3" type="text" id="eleresourcefee" readonly="readonly" value="${business.eleresourcefee }" name="eleresourcefee" onblur="eleresourcefeeTest()"/></td>
							<td><span id="tip3"></span> </td>
						</tr>
						<tr class="bbD">
							<td class="td">采购时间：</td>
							<td>
							<input value="${sourcingtime }" class="input3" name="ssourcingtime" id="sourcingtime" readonly="readonly" />
							</td>
						</tr>
						<tr class="bbD">
							<td class="td">采购级别：</td>
							<td>
								<select class="input3" name="sourcinglevel" disabled="disabled" id="sourcinglevel">
									<option value="1" ${business.sourcinglevel eq 1? "selected" : "" }>一般</option>
									<option value="2" ${business.sourcinglevel eq 2? "selected" : "" }>重要</option>
									<option value="3" ${business.sourcinglevel eq 3? "selected" : "" }>非常重要</option>
								</select>
							</td>
						</tr>
						<tr class="bbD">
							<td class="td">采购方式：</td>
								<td>
									<select class="input3" name="sourcingmethod" disabled="disabled" id="sourcingmethod">
										<option value="1" ${business.sourcingmethod eq 1? "selected" : "" }>单独采购</option>
										<option value="2" ${business.sourcingmethod eq 2? "selected" : "" }>联合采购</option>
										<option value="3" ${business.sourcingmethod eq 3? "selected" : "" }>其他</option>
									</select>
								</td>
						</tr>
						<tr class="bbD">
							<td class="td">采购途径：</td>
								<td>
									<select class="input3" name="sourcingway" disabled="disabled" id="sourcingway">
										<option value="1" ${business.sourcingway eq 1? "selected" : "" }>直接采购</option>
										<option value="2" ${business.sourcingway eq 2? "selected" : "" }>招标采购</option>
										<option value="3" ${business.sourcingway eq 3? "selected" : "" }>代理采购</option>
									</select>
								</td>
						</tr>
						<tr class="bbD">
							<td class="td">分配情况：</td>
							<td>
								<select class="input3" name="allot" disabled="disabled" id="allot">
										<option value="0" ${business.allot eq 0? "selected" : "" }>未分配</option>
										<option value="1" ${business.allot eq 1? "selected" : "" }>已分配</option>
								</select>
							</td>
						</tr>
						<tr class="bbD">
							<td class="td">审核状态：</td>
							<td>
								<select class="input3" name="checkstate" disabled="disabled" id="checkstate">
										<option value="0" ${business.checkstate eq 0? "selected" : "" }>未审核</option>
										<option value="1" ${business.checkstate eq 1? "selected" : "" }>已审核</option>
								</select>
							</td>
						</tr>
						<tr class="bbD">
							<td class="td">跟进状态：</td>
							<td>
								<select class="input3" name="follow" disabled="disabled" id="follow">
										<option value="1" ${business.follow eq 1? "selected" : "" }>意向</option>
										<option value="2" ${business.follow eq 2? "selected" : "" }>潜在</option>
										<option value="3" ${business.follow eq 3? "selected" : "" }>报价</option>
										<option value="4" ${business.follow eq 4? "selected" : "" }>成交</option>		
								</select>
							</td>
						</tr>
						<tr class="bbD">
							<td class="td">阶段状态：</td>
							<td>
								<select class="input3" id="stage" disabled="disabled" name="stage">
									<option value="1" ${business.stage eq 1? "selected" : "" }>初步接洽</option>
									<option value="2" ${business.stage eq 2? "selected" : "" }>需求确定</option>
									<option value="3" ${business.stage eq 3? "selected" : "" }>方案/报价</option>
									<option value="4" ${business.stage eq 4? "selected" : "" }>谈判合同</option>
									<option value="5" ${business.stage eq 5? "selected" : "" }>赢单</option>
										
								</select>							
							</td>
						</tr>
						
						<tr class="bbD">
							<td class="td">备注信息：</td>
							<td class="btext2" >
								<textarea class="text2" readonly="readonly" name="remark" id="remark">${business.remark }</textarea>
							</td>
						</tr>
					</table>	
						<input class="input3" type="submit" value="关闭" id="submit" />
				
				</div>
				</form>
			</div>

			<!-- 上传广告页面样式end -->
		</div>
	</div>
<script type="text/javascript">
var names ; //定义数据  
//开始函数  
$().ready(function(){  
$.ajax({  
	url: "getOrganizationList", 
type:'POST',    
dataType: "json",  
success:function(data){  
  names = data;  
  autocompleteFn(names);  
}  
});  
});  
//自动 补全方法  
function autocompleteFn(names){  
$("#orgName").autocomplete(names,{  
 minChars:1,  
 max: 5,  
 dataType:"json",  
 autoFill: true,  
 mustMatch: true,  
 matchContains: true,  
 scrollHeight: 220,
 formatItem: function(data, i, total) {  
   return "<I>"+data.name+"</I>";  
 },  
 formatMatch: function(data, i, total) {  
   return data.name;  
 },  
 formatResult: function(data) {  
   return data.name;  
 }  
}).result(function(event,data){
	   /* 机构名称 */
		$("#orgName").val(data.name);
	   /* 机构id */
	   $("#oid").val(data.id);
	   /* 联系人 */
	   $("#cname").val(data.contact.name);
	   /*手机号码 */
	   $("#cphone").val(data.contact.phone);
	   /* 经办人 */
	   $("#ename").val(data.contact.ename);
});  
}  

/* 对机构名是否输入做验证 */
function orgNameTest(){
	$("#tip1").html("");
	if($("#orgName").val()==""||$("#orgName").val()==null){
		/* 机构id */
		   $("#oid").val("");
		   /* 联系人 */
		   $("#cname").val("");
		   /*手机号码 */
		   $("#cphone").val("");
		   /* 经办人 */
		   $("#ename").val("");
		$("#tip1").html("请输入机构名").css({"color":"red"});
		return false;
	}else{
		return true;
	}
}

/* 判断是否输入为数字 */
function isNum(i){
	
	 var reg = /^\d+$/;
	 if(i==""){
		 return false;
	 }else if(!reg.test(i)){
		 return false;
	 }else{
		 return true;
	 }
 }
 /*判断年费是否为数字  */
 function annualfeeTest(){
	 $("#tip2").html("");
	 var r = isNum($("#annualfee").val());
	 if(!r){
		 $("#tip2").html("请输入正整数").css({"color":"red"});
		 return false;
	 }else{
		 return true;
	 }
 }
 /* 判断电子经费是否为数字 */
function eleresourcefeeTest(){
	 $("#tip3").html("");
	 var r = isNum($("#eleresourcefee").val());
	 if(!r){
		 $("#tip3").html("请输入正整数").css({"color":"red"});
	 }
	 return r;
 }
 
</script>
</body>
</html>